//抛物线特效
seajs.use(["parabola"],function(parabola){
	$(function(){
		
	$(".joinCar").click(function(event){
			
        event.stopPropagation();
 		let src=$(this)[0].previousElementSibling.previousElementSibling.previousElementSibling.src;       
		let evt = event || window.event;
		let scrollTop=document.documentElement.scrollTop||document.body.scrollTop;
        let endx=$("#n_shop").offset().left;
        let endy=$("#n_shop").offset().top;
		parabola.parabola({x:evt.pageX,y:evt.pageY},{x:endx,y:endy},src,function(){
			$("#num1")[0].innerHTML =  parseInt($("#num1")[0].innerHTML)+1;
			$("#num2")[0].innerHTML =  parseInt($("#num2")[0].innerHTML)+1;
		});
	})
	$("#goods_add").click(function(event){
		let src=$(this)[0].parentNode.parentNode.children[0].children[0].children[0].src;
		let evt = event || window.event;
		let scrollTop=document.documentElement.scrollTop||document.body.scrollTop;
        let endx=$("#a_shop").offset().left;
        let endy=$("#a_shop").offset().top;
		parabola.parabola({x:evt.pageX,y:evt.pageY},{x:endx,y:endy},src,function(){
			$("#num1")[0].innerHTML =  parseInt($("#num1")[0].innerHTML)+1;
			$("#num2")[0].innerHTML =  parseInt($("#num2")[0].innerHTML)+1;
		});
		$.ajax({
				type:"get",
				url:"php/addShoppingCart.php",
				async:true,
				data:{
					vipName:str,
					goodsId:"0001",
					goodsCount:$("#goods_text").val()
				},
				success:function(data){
					if(data=="1"){
					alert("添加成功");
					}else if(data=="0"){
					alert("添加失败");
					}
				}
			});
		})
	})
});

